package com.ljh.mall.service.Impl;

import com.ljh.mall.mybatis.mapper.PmsProductDao;
import com.ljh.mall.mybatis.model.PmsProduct;
import com.ljh.mall.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private PmsProductDao pmsProductDao;

    @Override
    public int addProduct(PmsProduct pmsProduct) {
        return pmsProductDao.insertSelective(pmsProduct);
    }

    @Override
    public int deleteProductById(Long id) {
        return  pmsProductDao.deleteByPrimaryKey(id);
    }

    @Override
    public int updateProductById(PmsProduct pmsProduct) {
        return pmsProductDao.updateByPrimaryKeySelective(pmsProduct);
    }

    @Override
    public PmsProduct selectProductById(Long id) {
        return pmsProductDao.selectByPrimaryKey(id);
    }

    @Override
    public List<PmsProduct> showProducts() {
        return pmsProductDao.showProducts();
    }


}
